package com.xuanyue.componentauth.init;

import com.xuanyue.componentauth.token.TokenCfg;
import com.xuanyue.componentauth.token.TokenTool;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class TokenInit implements ApplicationRunner {

    @Resource
    private ApplicationContext applicationContext;

    @Override
    public void run(ApplicationArguments args) throws Exception {

        TokenCfg cfg = applicationContext.getBean(TokenCfg.class);
        TokenTool.init( cfg );
    }
}
